﻿using System;
using Bank.Services;
using System.Diagnostics.Contracts;

namespace Bank.Operations
{
    public class OutPayment : Operation
    {
        decimal _amountOutPayment;

        public OutPayment(Decimal amountOutPayment) 
        {
            Contract.Requires(amountOutPayment > 0);

            _amountOutPayment = amountOutPayment;

        }

        public OutPayment(Money amountOutPayment)
        {
            Contract.Requires(amountOutPayment.Kwota > 0);

            _amountOutPayment = amountOutPayment.Kwota;

        }

        public OutPayment(IOperationLogger operationLogger)
        {
            _operationLogger = operationLogger;
        }

        public override void ExecuteOperation(IAccount account)
        {
            Contract.Requires(account.Ballance >= _amountOutPayment);

            base.ExecuteOperation(account);
        }

        public override void ExecuteOperation2(IAccount account)
        {
            Contract.Requires(account.Ballance >= _amountOutPayment);

            base.ExecuteOperation2(account);
        }

        public override string GetOperationName()
        {
            return GetType().Name;
        }
    }
}
